<template>
    <div class="list" ref='wrapper' >
      <div>

      <div class="area">
       <div class="title border-topbottom">所在城市</div>
       <div class="item-list">
         <div class="itemwrapper">
          <div class="item">
            {{this.city}}
          </div>
         </div>
       </div>
     </div>

     <div class="area">
       <div class="title border-topbottom">热门城市</div>
        <div class="item-list">
        <div class="itemwrapper"
             v-for="item of ar.hotCities"
             :key='item.id'
             @click="hotClick(item.name)"
             >
             <div class="item">{{item.name}}</div>
        </div>
       </div>
     </div>

     <div ref='A' class="area" id='pp'>
       <div class="title border-topbottom">A</div>
       <div class="end-list">
         <div  @click="hotClick('1313132')" class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='B' class="area" id='pp'>
       <div class="title border-topbottom">B</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='C' class="area" id='pp'>
       <div class="title border-topbottom">C</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='D' class="area" id='pp'>
       <div class="title border-topbottom">D</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='E' class="area" id='pp'>
       <div class="title border-topbottom">E</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='F' class="area" id='pp'>
       <div class="title border-topbottom">F</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>

     <div ref='G' class="area" id='pp'>
       <div class="title border-topbottom">G</div>
       <div class="end-list">
         <div class="end-item border-bottom" >56445645</div>
       </div>
     </div>
     <!-- <div   :ref='key' class="end-arear" v-for="(item,key) of cityList" :key="key">
       <div  class="title border-topbottom">{{key}}</div>
       <div class="end-list">
         <div class="end-item border-bottom" v-for=" el of item" :key="el.id">
           {{el.name}}
          </div>
       </div>
     </div> -->
    </div>
    </div>
</template>

<script>
import Bscroll from 'better-scroll'
import {mapState, mapMutations} from 'vuex'

export default {
  name: 'list',
  methods: {
    hotClick (e) {
      this.changeCity(e)
      this.$router.push('/')
    },
    ...mapMutations(['changeCity'])
  },
  computed: {
    ...mapState({
      city: 'city'
    }
    )
  },
  data () {
    return {
      cityList: []
    }
  },
  mounted () {
    this.cityList = this.ar.cities
    this.scroll = new Bscroll(this.$refs.wrapper)
  },
  props: {
    ar: Object,
    letter: String
  },
  watch: {
    letter () {
      let ele = this.$refs[this.letter]
      this.scroll.scrollToElement(ele)
    }
  }
}
</script>

<style lang='stylus' scoped>
@import '~styles/varibles.styl'
.border-topbottom
 &:before
   border-color:#777
 &:after
   border-color:#777
.border-bottom
 &:befoborderre
   border-color:#777
.list
  position :absolute
  top:1.6rem
  left :0
  right :0
  bottom :0
  overflow :hidden
  .title
   line-height :.44rem
   background :#eee
   padding-left :.2rem
   color :#666
   font-size :.26rem
  .item-list
   padding: .1rem .6rem .1rem .1rem
   overflow:hidden
   .itemwrapper
    float :left
    width :33.33%
    .item
     padding :.1rem 0
     text-align :center
     margin :.1rem .2rem
     border:0.02rem solid #ccc
     border-radius :.06rem
  .end-list
   .end-item
    line-height :.76rem
    padding-left :.2rem
</style>
